//
//  LaunchScreen.swift
//  Employee
//
//  Created by swordjoy on 2017/8/8.
//  Copyright © 2017年 remotevillage. All rights reserved.
//

import UIKit

class LaunchScreen: UIView {

    fileprivate var screenImageView: UIImageView!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        config()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}

// MARK: - interface
extension LaunchScreen {
    
    func show() {
        SJApp.keyWindow.addSubview(self)
        
        UIView.animate(withDuration: 0.28, animations: { self.alpha = 0},
                       completion: { (fini) in self.removeFromSuperview() })
    }
    
}

// MARK: - config
extension LaunchScreen {
    
    fileprivate func config() {
        backgroundColor = UIColor.white
        
        screenImageView = UIImageView(frame: bounds)
        screenImageView.image = UIImage(named: "launchpage")
        addSubview(screenImageView)
    }
    
}
